<?php
use yii\helpers\Url;

$web = Url::base();

?>
<script type="application/javascript">

    //var walfareId = '';

    $(function ($) {
        loading.hide();


        if ("<?= $filter ?>" == 0) {
            $('#searchUser').val("");
        } else {
            $('#searchUser').val("<?= $filter ?>");
        }

        totalPage =<?=$paginationDetail['totalPage']?>;
        detailPage =<?=$paginationDetail['page']?>;

        $("#prePage").css("visibility", "show");
        $("#nextPage").css("visibility", "show");
        if (totalPage < 2) {
            $("#prePage").css("visibility", "hidden");
            $("#nextPage").css("visibility", "hidden");
        } else if (detailPage == 1) {
            $("#prePage").css("visibility", "hidden");
        } else if (detailPage == totalPage) {
            $("#nextPage").css("visibility", "hidden");
        }

        //翻页
        $("#prePage").click(function () {
            detailPage = detailPage - 1;
            searchUser(1);
        });
        $("#nextPage").click(function () {
            detailPage = detailPage + 1;
            searchUser(1);
        });

    });

    //搜索
    /*function searchUser() {
     //var institutionCode = $("#select2").val();

     var filter;
     var f = $('#searchUser').val()._trim();
     if (f == '') {
     filter = 0;
     } else {
     filter = f;
     }
     var href = window.location.href;
     var index = href.indexOf("?");
     if (index > 0) {
     href = href.substr(0, index);
     }
     var href_str = href + "?filter=" + filter + "&id=" + walfareId;
     window.location.href = href_str;
     loading.show();

     }*/

    //返回
    /*function goback() {
     window.location.href = "<?=Url::to(["integral/index"])?>";
     loading.show();
     }*/

</script>


<div class="table-responsive">
    <table class="table table-bordered table-hover table-condensed"
           id="institutionTable">
        <thead>
        <tr>
            <th>用户编码</th>
            <th>用户名</th>
            <th>电话</th>
            <th>分数</th>
        </tr>
        </thead>
        <tbody>
        <?php
        for ($i = 0; $i < count($record); $i++) {
            ?>
            <tr>
                <td><?= $record[$i]['user_code'] ?></td>
                <td><?= $record[$i]['name'] ?></td>
                <td><?= $record[$i]['phone'] ?></td>
                <td><?= $record[$i]['integral'] ?></td>
            </tr>
            <?php
        }
        ?>
        </tbody>
    </table>
</div>
<!--<div class="pull-left">
            <? /*= \yii\widgets\LinkPager::widget(['pagination' => $paginationDetail]) */ ?>
        </div>-->
<div class="row">
    <div class="pull-right">
        <ul class="pager">
            <li><a id="prePage">上一页</a></li>
            <li><a id="nextPage">下一页</a></li>
        </ul>
        <!--<button class="btn btn-link" type="button" onclick="goback()"> 《返回
        </button>-->
    </div>
</div>
